#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = long double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 2e5 + 10;
const db eps = 1e-15;
const db pi = acos(-1.0);

pll v[N];
map < pll, int > f;
int ans, cnt;
ll a, b, c;

void reduce(pll &v) {
	ll t = __gcd(v.fi, v.se);
	if(t == 0) return;
	if(t < 0) t = -t;
	v.fi /= t; v.se /= t;
}

void add(pll v, int ct) {
	if(v.fi == 0 && v.se == 0) {
		f[v] += ct; return;
	}
	ans -= min(f[v], f[{ -v.fi, -v.se }]);
	f[v] += ct;
	ans += min(f[v], f[{ -v.fi, -v.se }]);
}

db getarc(pll c) {
	db res = atan2(c.se, c.fi) * 180 / pi;
	if(res >= 0) return res;
	else return res + 360;
}

struct cmp {
	bool operator ()(const db &a, const db &b) const { return a + eps < b; }
};

multiset < db, cmp > al;
multiset < db, cmp > delta;

db getdelta(db p, db s) {
	if(s >= p) return s - p;
	else return s + 360 - p;
}

void ins(db v) {//return;
	//cerr << "!" << v << endl;
	al.insert(v); auto it = al.find(v);
	auto preit = it, nxtit = it;
	if(preit == al.begin()) preit = al.end();
	preit--; nxtit++;
	if(nxtit == al.end()) nxtit = al.begin();
	//	cerr << *preit << " --- " << *nxtit << endl;
	//assert(preit != al.end()); assert(nxtit != al.end());
	if(preit != nxtit) delta.erase(delta.find(getdelta(*preit, *nxtit)));
	if(it != preit) delta.insert(getdelta(*preit, *it));
	if(it != nxtit) delta.insert(getdelta(*it, *nxtit));
}

void era(db v) {//return;
	//cerr << "!" << v << endl;
	auto it = al.find(v);
	auto preit = it, nxtit = it;
	if(preit == al.begin()) preit = al.end();
	preit--; nxtit++;
	if(nxtit == al.end()) nxtit = al.begin();
	
	if(preit != nxtit) delta.insert(getdelta(*preit, *nxtit));
	if(preit != it) delta.erase(delta.find(getdelta(*preit, *it)));
	if(nxtit != it) delta.erase(delta.find(getdelta(*it, *nxtit)));
	al.erase(it);
	//cerr << "!" << v << endl;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	a = in, b = in, c = in;
	int n = in, tot = 0;;
	while(n--) {
		char op = getchar(); while(!isalpha(op)) op = getchar();
		if(op == 'A') {
			++cnt; ++tot;
			ll x = in, y = in, z = in;
			v[cnt].fi = (a + b + c) * x - (x + y + z) * a;
			v[cnt].se = (a + b + c) * y - (x + y + z) * b;
			reduce(v[cnt]); //cerr << "!" << v[cnt].fi << " " << v[cnt].se << endl;
			add(v[cnt], 1); ins(getarc(v[cnt]));
			//	cerr << v[cnt].fi << " " << v[cnt].se << " " << getarc(v[cnt]) << " :: " << (delta.size() ? *delta.rbegin() : -114514) << endl;
		} else {
			int t = in; add(v[t], -1); era(getarc(v[t])); tot--;
		}
		if(f[{ 0, 0 }] > 0) puts("1");
		else if(ans) puts("2");
		else if(tot < 3) puts("0");
		else if(*al.rbegin() - *al.begin() < 180) puts("0");
		else if(!delta.size() || *delta.rbegin() > 180) puts("0");
		else puts("3");
	}
	return 0;
}
